home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10712 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: inforamp.net!ts10-07
  2. From: rmorin@inforamp.net (Randy Charles Morin)
  3. Newsgroups: comp.lang.c++,comp.os.linux.development.apps,comp.os.linux.misc
  4. Subject: Re: Are str* functions okay in C++?
  5. Date: Sat, 09 Mar 96 18:14:20 GMT
  6. Organization: MiddleWorld SoftWare
  7. Message-ID: <4hshqa$pmm@sam.inforamp.net>
  8. References: <4hpvi0$gt6@news.platinum.com>
  9. NNTP-Posting-Host: ts10-07.tor.inforamp.net
  10. X-Newsreader: News Xpress Version 1.0 Beta #4
  11.  
  12. In article <4hpvi0$gt6@news.platinum.com>,
  13.    dcmark@platinum.com (Mark Juric) wrote:
  14. >Hi all,
  15. >  I am relatively new to C++ and I'm having a heck of a time porting a C
  16. >program to C++.  I have a function that opens a man page and tries to
  17. >determine if it points to another man page.  I use strtok and strcpy in the
  18. >function.  It works fine under Solaris 2.x, however, under Linux 1.2.x or
  19. >1.3.x it chokes on a delete[] statement after several hundred iterations.
  20. >Here's the function.  It dies under Linux on the delete[] path; statement.
  21.  
  22. I'm thinking that maybe the delete[] isn't the problem, but that when you 
  23. allocated the path array, the allocation may have failed.  Only you can check 
  24. this.  I don't know the implementation and I don't have Linux running in my 
  25. office.
  26.  
  27. I suggestion is to give up on old C functions that do string manipulation and 
  28. begin using a string class.  In the MFC library, the class CString is 
  29. great.  And in the OWL library, the class String is even better.  I don't know 
  30. what's available for Unix or if these classes are appropriate for your 
  31. framework.  Maybe somebody else will suggest or send you a string class.  HEY 
  32. EVERYBODY, SEND THIS GUY A WORKING LINUX CLASS.  Think they heard me?
  33.  
  34. Agrivar
  35.